package com.ai3d.rfid.common.utils

import android.os.Handler
import android.os.Looper

/**
 * @ProjectName : Trias
 * @Author : weijinsong
 * @Time : 2022/11/1 10:12
 * @Description : 线程切换
 */
object HandlerUtils {
    private val sHandler = Handler(Looper.getMainLooper())

    fun removeCallbacks(runnable: Runnable) {
        sHandler.removeCallbacks(runnable)
    }
    fun removeCallbacksAndMessages() {
        sHandler.removeCallbacksAndMessages(null)
    }

    fun post(runnable: Runnable) {
        sHandler.post(runnable)
    }

    fun postDelayed(runnable: Runnable, delayMillis: Long) {
        sHandler.postDelayed(runnable, delayMillis)
    }
}